#pragma once
#include "afxcmn.h"
#include "afxwin.h"
#include "pstat.h"
#include "SwordBibleFonts.h"
#include "AutoRichEditCtrl.h"

// CSearch dialog


class CSearch : public CDialog
{
	DECLARE_DYNAMIC(CSearch)

public:
	CSearch(CWnd* pParent);   // standard constructor
	sword::SWModule* pModule;
	static int cms_currentProgress;
	static void percentUpdate(char percent, void* userData); 
	static UINT Searcher(LPVOID dummy);
	static ULONG StatusDisplay(void* pData, CProgressThreadDlg* pProgressDlg);
	static int count;
	static int flag;
    static int searchType;
	static BOOL isSearching;
	static CString toSearch;
	static sword::ListKey searchResults; 
	static sword::VerseKey scope;
	virtual ~CSearch();
	CWnd * parent;
	CSwordBibleFonts font;

// Dialog Data
	enum { IDD = IDD_SEARCH };

protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
 

	DECLARE_MESSAGE_MAP()
public:
	// //control for the list that displays search results
	CListCtrl m_resultListControl;
	// lets user specify the book of bible where the search should start
	CComboBox m_searchStartControl;
	// lets user specify the book of bible where the search should end
	CComboBox m_searchEndControl;
	// should the search be case sensitive?
	BOOL m_IscaseSensitive;
	// match whole word when searching
	BOOL m_IsMatchWholeWord;
	// the text that user wants to search in the bible
	CString m_searchText;

	

	afx_msg void OnButtonSearch();
	virtual BOOL OnInitDialog();
	void SetSearchScope();

	BOOL m_radioEntire;
	afx_msg void OnNMDblclkListSearchresults(NMHDR *pNMHDR, LRESULT *pResult);
	afx_msg void OnClickSearchResults(NMHDR *pNMHDR, LRESULT *pResult);
	CAutoRichEditCtrl m_resultPreview;
};


